package dao.impl;

import com.google.common.collect.ImmutableMap;
import dao.UserDataProfileDao;
import domain.UserDataProfile;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * Created by aceyin on 15/6/30.
 */
@Repository
public class UserDataProfileDaoImpl extends BaseGenericDao<UserDataProfile, Long> implements UserDataProfileDao {
    @Override
    public void increaseEmployedQuantity(List<Long> appliers) {
        Map<String, Object> params = ImmutableMap.<String, Object>builder().put("ids", appliers).build();
        update("increase-employee-quantity", params);
    }

    @Override
    public void increaseWorkDoneTimes(List<Long> appliers) {
        Map<String, Object> params = ImmutableMap.<String, Object>builder().put("ids", appliers).build();
        update("increase-work-down-times", params);
    }

    @Override
    public void increaseSentFlower(long rater) {
        Map<String, Object> params = ImmutableMap.<String, Object>builder().put("id", rater).build();
        update("increase-sent-flower-count", params);
    }

    @Override
    public void increaseReceiveFlower(long ratee) {
        Map<String, Object> params = ImmutableMap.<String, Object>builder().put("id", ratee).build();
        update("increase-receive-flower-count", params);

    }

    @Override
    public void increaseSentEgg(long rater) {
        Map<String, Object> params = ImmutableMap.<String, Object>builder().put("id", rater).build();
        update("increase-sent-egg-count", params);

    }

    @Override
    public void increaseReceiveEgg(long ratee) {
        Map<String, Object> params = ImmutableMap.<String, Object>builder().put("id", ratee).build();
        update("increase-receive-egg-times", params);
    }

    @Override
    public void decreaseEmployQuantity(List<Long> list) {
        Map<String, Object> params = newMapBuilder().put("ids", list).build();
        update("decrease-employed-times", params);
    }
}
